#!/bin/bash

# 测试拆分后的机器详情API接口
# 测试机器号1的四个拆分接口

echo "=== 测试拆分后的机器详情API接口 ==="
echo "测试机器号: 1"
echo ""

# 设置基础URL
BASE_URL="http://localhost:8080/api/monitor/machines/1"

echo "1. 测试基本信息接口 (/basic)"
echo "请求: GET $BASE_URL/basic"
response1=$(curl -s -w "\nHTTP状态码: %{http_code}\n" "$BASE_URL/basic")
echo "$response1"
echo ""

echo "2. 测试图表数据接口 (/charts)"
echo "请求: GET $BASE_URL/charts"
response2=$(curl -s -w "\nHTTP状态码: %{http_code}\n" "$BASE_URL/charts")
echo "$response2"
echo ""

echo "3. 测试疵点统计接口 (/defects)"
echo "请求: GET $BASE_URL/defects"
response3=$(curl -s -w "\nHTTP状态码: %{http_code}\n" "$BASE_URL/defects")
echo "$response3"
echo ""

echo "4. 测试梳栉详情接口 (/guide-bars)"
echo "请求: GET $BASE_URL/guide-bars"
response4=$(curl -s -w "\nHTTP状态码: %{http_code}\n" "$BASE_URL/guide-bars")
echo "$response4"
echo ""

echo "5. 测试已废弃的完整详情接口 (/detail)"
echo "请求: GET $BASE_URL/detail"
response5=$(curl -s -w "\nHTTP状态码: %{http_code}\n" "$BASE_URL/detail")
echo "$response5"
echo ""

echo "=== 测试完成 ==="
echo ""
echo "说明："
echo "- 前四个接口是拆分后的新接口，应该返回200状态码"
echo "- 最后一个接口是已废弃的完整接口，应该仍然可用但会返回完整数据"
echo "- 如果应用未启动，请先运行 ./start.sh 启动应用"
